#pragma once

#include "Types.h"
#include "SurfaceDesc.h"

namespace Vortex { namespace Wrapper { namespace Direct3D {

	ref class Direct3DDevice9;

	///<summary>Contains information about locked bits</summary>
	public value struct D3DLockedRect {
		int Pitch;
		void* pBits;
	};

	///<summary>Wrapper of IDirect3DSurface9 interface</summary>
	public ref class Direct3DSurface9 {
		IDirect3DSurface9* _handle;
		SurfaceDesc^ _description;

	public:

		///<summary>Direct3DDevice handle</summary>
		property IntPtr Handle { IntPtr get() { return IntPtr(_handle); } }

		property IDirect3DSurface9* NativeHandle { IDirect3DSurface9* get() { return _handle; } }

		Direct3DSurface9(IDirect3DSurface9* handle);

		~Direct3DSurface9();

		///<summary>Surface description</summary>
		property SurfaceDesc^ Description {
			SurfaceDesc^ get() { return _description; } 
		}

		HResult LockRect(System::Drawing::Rectangle rectToLock, D3DLock lockFlags, [Out] D3DLockedRect% lockedRect);

		HResult UnlockRect();

		HResult GetDC([Out] IntPtr% hDC);

		HResult ReleaseDC(IntPtr hDC);
		
	};
}}}